package com.bigShen.mybatis.spring;

import com.bigShen.mybatis.spring.entity.UserInfo;
import com.bigShen.mybatis.spring.service.UserInfoService;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author : lei.shen
 * @date : 2018/12/20
 */
public class MyBatisSpringHelloWorld {

    static UserInfoService userInfoService;

    @BeforeClass
    public static void init() {

        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        userInfoService = context.getBean(UserInfoService.class);

    }

    @Test
    public void testSelect() {
        String userName = "系统运维员";
        List<UserInfo> userInfos = userInfoService.selectUserByName(userName);
        System.out.println(userInfos);
    }

}
